<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>Insert title here</title>
		<script type="text/javascript">
			function convert_long() {
				
				// 获取输入的长度
				var lengthValue = document.getElementById("length").value;
				
				// 获取从什么单位
				var $from = document.getElementById("from");
				var fromIndex = $from.selectedIndex;
				var fromValue = $from.options[fromIndex].value;
				if (fromValue == '摄氏度（℃）') {
						lengthValue = lengthValue;
					} else if (fromValue == '华氏度（℉）') {
						lengthValue = (temptValue-32) / 1.8;
					} else if (fromValue == '开氏度(K)') {
						lengthValue = temptValue -273.15 ;
					}else if (fromValue == '列式度（°Re）') {
						lenngthValue =  temptValue *1.25;
					} else if (fromValue == '兰氏度（°R）') {
						lengthValue = temptValue / 1.8 -273.15 ;
					}
				
				// 获取到什么单位
				var $to = document.getElementById("to");
				var toIndex = $to.selectedIndex;
				var toValue = $to.options[toIndex].value;
				
				var target = 0;
				if (toValue == '摄氏度（℃）') {
						target = lengthValue;
					} else if (toValue == '华氏度（℉）') {
						target = 32+lengthValue*1.8;
					} else if (toValue == '开氏度(K)') {
						target = lengthValue*1 +273.15;
					} else if (toValue == '列式度（°Re）') {
						target = lengthValue/1.25;
					} else if (toValue == '兰氏度（°R）') {
						target = (lengthValue*1 + 273.15)*1.8;
					}
				document.getElementById('result').value = target;
				
			}
		</script>
		<style>
			html{
				background-color: rgb(80,44,108);
			}
			div{
				background-color: rgb(80,44,108);
				opacity: 0.9;
			}
			#a{
				font-size: 30px;
				margin-bottom: 5px;
				padding: 10px;
			}
			#d{
				padding: 10px;
			}
			#b{
				padding: 2%;
			}
			#db{
				margin-left: 20px;
			}
			.tx{
				font-size: 20px;
				padding: 10px;
			}
		</style>
	</head>
	<body>
		<div id="a" class="tx" align="center">
			温度的换算
		</div>
		
		<div id="b" align="center">
			<font id="ba" class="tx">温度：</font><input type="text" id="length">
			<font id="bb" class="tx">从：</font>
				<select id="from">
					<option>摄氏度（℃）</option>
					<option>华氏度（℉）</option>
					<option>开氏度(K)</option>
					<option>列式度（°Re）</option>
					<option>兰氏度（°R）</option>
				</select>
		</div>
		
		<div id="c" align="center">
			<font id="ca" class="tx">结果：</font>
			<input type="text" disabled="disabled" id="result">	
			<font id="cb" class="tx">到：</font>
				<select id="to">
					<option>摄氏度（℃）</option>
					<option>华氏度（℉）</option>
					<option>开氏度(K)</option>
					<option>列式度（°Re）</option>
					<option>兰氏度（°R）</option>
				</select>
		</div>
		
		<div id="d" align="center">
			<button type="button" onclick="return convert_long()"  id="da">转换</button>
			<a href="../../../index.html"><button type="button"  id="db">返回</button></a>
		</div>
	</body>
</html>